package com.ghpt.controller;
import com.ghpt.pojo.NingQiShi;
import com.ghpt.service.NingQiShiService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/ningqi")
public class NingQiShiController {
    private final NingQiShiService ningQiShiService;

    public NingQiShiController(NingQiShiService ningQiShiService) {
        this.ningQiShiService = ningQiShiService;
    }
    @GetMapping("/{id}")
    public NingQiShi getNingQiShiById(@PathVariable Long id) {
        System.out.println("结果是"+ningQiShiService.findNingQiShiById(id));
        return ningQiShiService.findNingQiShiById(id);
    }
    @PutMapping
    public int updateNingQiShi(@RequestBody NingQiShi ningQiShi) {
        return ningQiShiService.updateById(ningQiShi);
    }
}
